import { View } from "../../../mvc/core/View";
import { GTextFormat } from "../../../common/GTextFormat";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
type int = number;
//class PetAttrPanel
    
    export  class PetAttrPanel extends View
    {
        constructor(arg1: Array<any>=null, arg2: GTextFormat=null, arg3: GTextFormat=null, arg4: GTextFormat=null, arg5: int=20)
        {
            super();
            this._attrTxtArray = [];
            this._attrAddTxtArray = [];
            this._attrLabelTxtArray = [];
            this._attrLabelArray = arg1;
            this._labelTextFormat = arg3 != null ? arg3 : GlobalStyle.textFormat1;
            this._valueTextFormat = arg4 != null ? arg4 : GlobalStyle.textFormat2;
            this._addTextFormat = arg2;
            this._gap = arg5;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc1="";
            var loc5=0;
            while (loc5 < this._attrLabelArray.length) 
            {
                loc1 = this._attrLabelArray[loc5];
                loc2 = ObjCreate.createGTextField(loc1, 0, 0 + loc5 * this._gap, 70, 20, this, this._labelTextFormat);
                loc2.autoSize = flash.text.TextFieldAutoSize.LEFT;
                loc3 = ObjCreate.createTextField("", 60, 0 + loc5 * this._gap, 160, 20, this, this._valueTextFormat);
                loc3.autoSize = flash.text.TextFieldAutoSize.LEFT;
                (loc4 = ObjCreate.createTextField("", 95, 0 + loc5 * this._gap, 160, 20, this, this._addTextFormat)).autoSize = flash.text.TextFieldAutoSize.LEFT;
                loc4.visible = true;
                this._attrLabelTxtArray.push(loc2);
                this._attrTxtArray.push(loc3);
                this._attrAddTxtArray.push(loc4);
                ++loc5;
            }
            return;
        }

        public hideAttr(arg1: int): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            while (loc4 < this._attrLabelArray.length) 
            {
                loc1 = this._attrLabelTxtArray[loc4];
                loc2 = this._attrTxtArray[loc4];
                loc3 = this._attrAddTxtArray[loc4];
                if (loc4 != arg1) 
                {
                    if (loc4 > arg1) 
                    {
                        loc1.y = loc1.y - this._gap;
                        loc2.y = loc2.y - this._gap;
                        loc3.y = loc3.y - this._gap;
                    }
                }
                else 
                {
                    loc1.visible = false;
                    loc2.visible = false;
                    loc3.visible = false;
                }
                ++loc4;
            }
            return;
        }

        public resetPos(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            while (loc4 < this._attrLabelArray.length) 
            {
                loc1 = this._attrLabelTxtArray[loc4];
                loc2 = this._attrTxtArray[loc4];
                loc3 = this._attrAddTxtArray[loc4];
                loc1.y = 0 + loc4 * this._gap;
                loc2.y = 0 + loc4 * this._gap;
                loc3.y = 0 + loc4 * this._gap;
                loc1.visible = true;
                loc2.visible = true;
                loc3.visible = true;
                ++loc4;
            }
            return;
        }

        public updateValue(arg1: Array<any>): void
        {
            var loc1=null;
            var loc2=0;
            while (loc2 < this._attrTxtArray.length) 
            {
                loc1 = this._attrTxtArray[loc2] as Object /* flash.text.TextField */;
                loc1.text = arg1[loc2].toString();
                ++loc2;
            }
            return;
        }

        public updateAddValue(arg1: Array<any>): void
        {
            var loc1=null;
            var loc2=0;
            while (loc2 < this._attrAddTxtArray.length) 
            {
                loc1 = this._attrAddTxtArray[loc2] as Object /* flash.text.TextField */;
                loc1.text = "(+" + arg1[loc2] + ")";
                ++loc2;
            }
            return;
        }

        public regLabelTip(arg1: Array<any>): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            while (loc3 < this._attrLabelTxtArray.length) 
            {
                loc1 = this._attrLabelTxtArray[loc3] as GTextFiled;
                loc2 = arg1[loc3] as string;
                loc1.toolTipData = loc2;
                ++loc3;
            }
            return;
        }

        public clear(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            while (loc3 < this._attrTxtArray.length) 
            {
                loc1 = this._attrTxtArray[loc3] as Object /* flash.text.TextField */;
                loc1.text = "";
                loc2 = this._attrAddTxtArray[loc3] as Object /* flash.text.TextField */;
                loc2.text = "";
                ++loc3;
            }
            return;
        }

        protected /* var */_attrLabelArray: Array<any>;

        protected /* var */_attrTxtArray: Array<any>;

        /* internal */ /* var */_attrAddTxtArray: Array<any>;

        /* internal */ /* var */_attrLabelTxtArray: Array<any>;

        /* internal */ /* var */_labelTextFormat: GTextFormat;

        /* internal */ /* var */_valueTextFormat: GTextFormat;

        /* internal */ /* var */_addTextFormat: GTextFormat;

        /* internal */ /* var */_gap: int;
    }
